package cn.xorange.commons.datasource.constants;


import java.util.HashMap;
import java.util.Map;
import java.util.Properties;

/**
 * @author yangjian
 */
public class DataDefaultConstants {
    private DataDefaultConstants(){}

    public static final Map<String,Object> sysDB(){
        Map<String,Object> sys = new HashMap<>();
        sys.put("url","jdbc:sqlite:mickey-commons/mickey-commons-data/src/main/resources/sqlite/sys.db?date_string_format=yyyy-MM-dd HH:mm:ss");
        return sys;
    }
    public static final Map<String,Object> druidConfig(){
        Map<String,Object> druid = new HashMap<>();
        //数据
        //初始化数量
        druid.put("initialSize",5);
        //最大活跃数
        druid.put("maxActive",20);
        // 配置获取连接等待超时的时间
        druid.put("maxWait",60000);
        //最小空闲值.当空闲的连接数少于阀值时，连接池就会预申请去一些连接，以免洪峰来时来不及申请
        druid.put("minIdle",8);
        // 配置间隔多久才进行一次检测，检测需要关闭的空闲连接，单位是毫秒
        druid.put("timeBetweenEvictionRunsMillis",600000);
        // 配置一个连接在池中最小生存的时间，单位是毫秒
        druid.put("minEvictableIdleTimeMillis",300000);
        // 配置一个连接在池中最大生存的时间，单位是毫秒
        druid.put("manEvictableIdleTimeMillis",900000);
        // 配置检测连接是否有效
        druid.put("validationQuery","SELECT 1");
        druid.put("testWhileIdle","true");
        druid.put("testOnBorrow","false");

        //配置
        druid.put("name","admin");
        druid.put("password","123456");
        // 默认允许所有
        druid.put("allow","");
        //黑名单
        druid.put("deny","192.168.31.253");
        //排除类型
        druid.put("exclusions","*.js,*.css,/druid/*");
        return druid;
    }
    public static final Properties jtaConfig(){
        Properties p = new Properties();
        //事务日志目录，默认为
        p.setProperty("com.atomikos.icatch.log_base_dir","transaction-logs");
        return p;
    }

    public static final String MYBATIS_MAPPER_LOCATIONS = "classpath*:mapper/**/*Mapper.xml";

}
